var http=require("http");
var fs=require("fs");//node原生环境；读文件，获取文件buffer数据
var path=require("path");
http.createServer((req,res)=>{
    res.writeHead(200,{"Content-Type":"text/html"});
    //向网页中添加图片(小图标转成base64的)
    var filePath=path.join(__dirname,"/group.png");
    var imgBuf=fs.readFileSync(filePath);
    var imgBase64=imgBuf.toString("base64");
    res.write("<!DOCTYPE html><html>"+
        "<head></head><body style='background:red;'>"+
        "<img src='data:image/png;base64,"+
            imgBase64
        +"'/>"+
        "</body></html>"
    );
    res.end();
}).listen(8081);

console.log("Sever is listening 8081");